<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/restrict/adminHome.xhtml">
	<ui:define name="titulo">
		<h:outputLabel value="MusicBay.com - #{msg.cadastrar} #{msg.artista}"/>
	</ui:define>

	<ui:define name="cont">
		<p:messages />
		<p:panel header="#{msg.cadastrar} #{msg.artista}">
			<h:form id="form">
				<h:panelGrid columns="3" cellpadding="7">
					<h:outputLabel value="#{msg.artista}" for="nome" class="label" />
					<h:panelGroup>
						<p:inputText value="#{artistaManagedBean.artista.nome}" id="nome" label="#{msg.nome}" required="true"
							size="30" maxlength="30" requiredMessage="#{msg.nome} #{msg.naoInformado}">
							<f:validateLength minimum="2" maximum="30" />
						</p:inputText>
					</h:panelGroup>
					<p:message for="nome" />

					<h:outputLabel value="#{msg.sobre} #{msg.artista}" for="sobre" class="label" />
					<h:panelGroup>
						<p:inputTextarea value="#{artistaManagedBean.artista.descricao}" cols="60" rows="10"
							id="sobre" autoResize="true" required="true" maxlength="500" requiredMessage="#{msg.descricao} #{msg.naoInformado}"/>
					</h:panelGroup>
					<p:message for="sobre" />

					<h:outputLabel value="#{msg.generoMusical}" for="genero" class="label" />
					<h:panelGroup styleClass="checkBox">
						<p:selectManyCheckbox value="#{artistaManagedBean.artista.generos}" id="genero"
							required="true" requiredMessage="#{msg.invalido}: #{msg.generoMusical}" layout="pageDirection"
							converter="generoConversor">
							<f:selectItems value="#{generoManagedBean.generos}" var="genero" itemLabel="#{genero.genero}"
								itemValue="#{genero}" />
						</p:selectManyCheckbox>
					</h:panelGroup>
					<p:message for="genero" />

					<p:commandButton id="showcadastroDialog" value="#{msg.cadastrar}" oncomplete="cadastroDialog.show()"  icon="ui-icon-check"/>

				</h:panelGrid>

				<p:confirmDialog id="cadastroDialog" message="#{msg.confirma} #{msg.cadastro}?"
					header="#{msg.confirma} #{msg.cadastro}?" severity="alert" widgetVar="cadastroDialog">

					<p:commandButton id="confirma" value="#{msg.confirma}" ajax="false"
						actionListener="#{artistaManagedBean.actionSave}" oncomplete="cadastroDialog.hide()" icon="ui-icon-check"/>
					<p:commandButton id="cancela" value="#{msg.cancelar}" onclick="cadastroDialog.hide()" type="button" icon="ui-icon-cancel" />
				</p:confirmDialog>
			</h:form>
		</p:panel>
	</ui:define>
</ui:composition>
</html>